﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Create_Tip.ascx.vb" Inherits="Control_Contents_Create_Tip" %>
<%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
<script type="text/javascript" language="javascript">

    function ConvertText() {
        txtTitle = document.getElementById("<%= txtTitle.ClientID %>");
        var str = txtTitle.value.trim();
        txtTitle.value = str.substring(0, 1) + str.substring(1, str.length).toLowerCase();
        return false;
    }
    function Change_Assign() {
        var chkIsHot = document.getElementById("<%=chkIsHot.ClientID %>");
        if (chkIsHot.checked == true) {
            $('#imageBig').show();
            ValidatorEnable(document.getElementById("<%=regImageBig.ClientID %>"), true);
        } else {
            $('#imageBig').hide();
            ValidatorEnable(document.getElementById("<%=regImageBig.ClientID %>"), false);
        }
    }
    function ajaxJquery() {

        $(document).ready(function () {
            $(".ItemDisabled").attr("disabled", "true");
            Change_Assign();
            //Upload Image
            $('#file_upload').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/Upload.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': false,
                'fileExt': '*.jpg;*.gif;*.png;*.jpeg;*.bmp',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG , .JPEG , .BMP)',
                'fileDataName': 'myfile',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    $('#<%=hidImagePath.ClientID %>').val('<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                    $('#<%=imgUpload.ClientID %>').attr("src", '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);

                }
            });

            //Upload Image Slider
            $('#file_big').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/Upload.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': false,
                'fileExt': '*.jpg;*.gif;*.png;*.jpeg;*.bmp',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG , .JPEG , .BMP)',
                'fileDataName': 'myfile',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    $('#<%=hidImageBig.ClientID %>').val('<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                    $('#<%=imagebig.ClientID %>').attr("src", '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);
                }
            });


            //file_upload_content
            var str = "";
            //Upload Album 
            $('#file_upload_content').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/UploadAlbum.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': true,
                'fileExt': '*.jpg;*.gif;*.png;*.jpeg;*.bmp',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG , .JPEG , .BMP)',
                'fileDataName': 'fileAlbum',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    str += '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response;
                },
                'onAllComplete': function (event, data) {
                    str += "0";
                    var myAlbum = new Array();
                    myAlbum = str.split(",");
                    str = "";
                    for (var i = 0; i < myAlbum.length - 1; i++) {
                        $("#<%= txtContent.ClientID %>").find('iframe').contents().find('body').append("<p align='center'><img alt=''  src='" + myAlbum[i] + "' /></p><p  align='center'>Sức sống mới</p>");
                    }
                }
            });

        });
    }
    function setKeyWordValue(value, sListId) {
        $("#<%=txtKeyword.ClientID()%>").val(sListId);
        $("#<%=txtStrKeyWord.ClientID()%>").val(value);
        removeAllOption('selKeyWord');
        appendOptionLast(sListId, value, 'selKeyWord');

    }
    function getKeywordValue() {
        return $("#<%=txtKeyword.ClientID()%>").val();
    }
    function settxtSubjectValue(value, id) {
        $("#<%=txtSubject.ClientID()%>").val(value);
        $("#<%=txtSubjectId.ClientID()%>").val(id);
    }

</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="content_porletform">
            <div class="DivRow">
                <div class="DivLabel">
                    <h3>
                        THÊM NỘI DUNG TIP
                    </h3>
                    <i>phần validate đang được disable để giúp cho việc biên tập nhanh hơn</i>
                </div>
                <div class="box_contentform">
                    <div class="box_scroll_grid">
                        <div class="lblEdit">
                            <span class="fieldRequired">&nbsp;</span>Trường yêu cầu nhập dữ liệu
                        </div>
                        <div class="Error">
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="#FF3300" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblTitle" CssClass="Tiêu đề" runat="server" Text="Tiêu đề:" /><span
                                class="fieldRequired">&nbsp;</span>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                                Display="None" ErrorMessage=" Vui lòng nhập tiêu đề bản tin."></asp:RequiredFieldValidator>
                        </div>
                        <div class="DivTextBox">
                            <asp:TextBox ID="txtTitle" CssClass="TextBox" runat="server" Text="" Width="460px" />
                            <asp:LinkButton ID="lnkConvertText" Text="convert text" CausesValidation="false"
                                OnClientClick="return ConvertText();" runat="server"></asp:LinkButton>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblDescription" CssClass="TextLabel" runat="server" Text="Mô tả:" />
                            <span class="fieldRequired">&nbsp;</span>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtDescription"
                                Display="None" ErrorMessage="Vui lòng nhập mô tả bản tin."></asp:RequiredFieldValidator>
                        </div>
                        <div class="DivTextBox">
                            <asp:TextBox ID="txtDescription" CssClass="TextBox" runat="server" Text="" Width="460px"
                                Height="100px" Rows="5" TextMode="MultiLine" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label3" CssClass="TextLabel" runat="server" Text="Ảnh nội dung:" />
                        </div>
                        <div class="DivTextBox">
                            <input id="file_upload_content" name="file_upload_content" type="file" />
                            <a id="uploadupd" href="javascript:$('#file_upload_content').uploadifyUpload();">Upload
                                Files</a>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblContent" CssClass="TextLabel" runat="server" Text="Nội dung:" />
                            <%--<span class="fieldRequired">&nbsp;</span>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtContent"
                Display="None" ErrorMessage="Vui lòng nhập nội dung."></asp:RequiredFieldValidator>--%>
                        </div>
                        <div class="DivTextBox">
                            <CE:Editor ID="txtContent" runat="server" Width="100%" Height="500" EditorWysiwygModeCss="~/example.css">
                                <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                    CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                            </CE:Editor>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label1" CssClass="TextLabel" runat="server" Text="Ảnh bài viết:" />
                            <span class="fieldRequired">&nbsp;</span>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="hidImagePath"
                                Display="None" ErrorMessage="Vui lòng chọn ảnh đại diện."></asp:RequiredFieldValidator>
                        </div>
                        <div class="DivTextBox">
                            <input id="file_upload" name="file_upload" type="file" /><a href="javascript:$('#file_upload').uploadifyUpload();">Upload
                                Files</a>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div style="height: 100px;" class="DivLabel">
                            <asp:Image ID="imgUpload" runat="server" BorderWidth="0px" Height="100px" Width="100px"
                                ImageUrl="~/Images/NoPhotoAvailable.jpg" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label2" CssClass="TextLabel" runat="server" Text="Tác giả:" />
                            <span class="fieldRequired">&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
                                runat="server" ControlToValidate="txtAuthor" Display="None" ErrorMessage="Vui lòng nhập tác giả."></asp:RequiredFieldValidator>
                            </span>
                        </div>
                        <div class="DivTextBox">
                            <asp:TextBox ID="txtAuthor" CssClass="TextBox" Text="" runat="server"></asp:TextBox>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label4" CssClass="TextLabel" runat="server" Text="Là tin nóng:" />
                            <asp:CheckBox ID="chkIsHot" onclick="Change_Assign();" runat="server" />
                        </div>
                    </div>
                    <div id="imageBig" style="display: none" class="DivRow">
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label8" CssClass="TextLabel" runat="server" Text="Ảnh Bigbaner:" />
                                <span class="fieldRequired">&nbsp;</span>
                                <asp:RequiredFieldValidator ID="regImageBig" runat="server" ControlToValidate="hidImageBig"
                                    Display="None" ErrorMessage="Vui lòng chọn ảnh Bigbaner."></asp:RequiredFieldValidator>
                            </div>
                            <div class="DivTextBox">
                                <input id="file_big" name="file_big" type="file" />
                                <a href="javascript:$('#file_big').uploadifyUpload();">Upload Files</a>
                            </div>
                        </div>
                        <div style="height: 100px;">
                            <asp:Image ID="imagebig" runat="server" BorderWidth="0px" Height="100px" Width="100px"
                                ImageUrl="~/Images/NoPhotoAvailable.jpg" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label5" CssClass="TextLabel" runat="server" Text="Tin mới:" />
                            <asp:CheckBox ID="chkIsNew" runat="server" />
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="lblMenu_property" CssClass="TextLabel" runat="server" Text="Nhánh tin:" />
                            <span class="fieldRequired">&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
                                runat="server" ControlToValidate="drlMenu" Display="None" ErrorMessage="Vui lòng chọn nhánh tin."
                                InitialValue="0"></asp:RequiredFieldValidator>
                            </span>
                        </div>
                        <div class="DivTextBox">
                            <asp:DropDownList ID="drlMenu" runat="server" CssClass="TextBox">
                            </asp:DropDownList>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label6" CssClass="TextLabel" runat="server" Text="Chủ đề:" />
                            <span class="fieldRequired">&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator6"
                                runat="server" ControlToValidate="txtSubject" Display="None" ErrorMessage="Vui lòng chọn chủ đề."></asp:RequiredFieldValidator>
                            </span>
                        </div>
                        <div class="DivTextBox">
                            <asp:TextBox ID="txtSubject" CssClass="TextBox" Enabled="false" Text="" runat="server"></asp:TextBox>&nbsp;<asp:HyperLink
                                ID="hplSelSubject" runat="server" CssClass="btn">Chọn</asp:HyperLink>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            <asp:Label ID="Label7" CssClass="TextLabel" runat="server" Text="Từ khóa:" />
                            <span class="fieldRequired">&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator7"
                                runat="server" ControlToValidate="txtKeyword" Display="None" ErrorMessage="Vui lòng nhập từ khóa."></asp:RequiredFieldValidator>
                            </span>
                        </div>
                        <div class="DivTextBox">
                            <select multiple="multiple" id="selKeyWord" style="width: 250px; height: 100px" class="TextBox">
                            </select>
                            &nbsp;<asp:HyperLink ID="hplSelKeyWord" runat="server" CssClass="btn">Chọn</asp:HyperLink>
                        </div>
                    </div>
                    <div class="DivRow">
                        <div class="DivLabel">
                            &nbsp;&nbsp;&nbsp;</div>
                        <div class="DivTextBox">
                            <asp:Button ID="btnSave" runat="server" Text=" Lưu " CssClass="btn" CausesValidation="false" />
                            &nbsp;<asp:Button ID="btnHuy" CausesValidation="false" runat="server" Text=" Hủy "
                                CssClass="btn" />
                        </div>
                    </div>
                </div>
                <div style="display: none">
                    <asp:HiddenField ID="hidID" Value="0" runat="server" />
                    <asp:TextBox ID="hidImagePath" Text="" runat="server" />
                    <asp:Button ID="btnReset" CausesValidation="false" runat="server" Text="Reload" />
                    <asp:HiddenField ID="hidType" Value="0" runat="server" />
                    <asp:TextBox ID="txtKeyword" CssClass="TextBox" Text="" runat="server" Visible="true"></asp:TextBox>
                    <asp:TextBox ID="txtStrKeyWord" CssClass="TextBox" Text="" runat="server" Visible="true"></asp:TextBox>
                    <asp:TextBox ID="txtSubjectId" CssClass="TextBox" Text="0" runat="server"></asp:TextBox>
                    <asp:TextBox ID="hidImageBig" Text="" runat="server" />
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
